package com.yj.web;


import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yj.entity.Collectionss;
import com.yj.service.ICollectionssService;
import com.yj.vo.JsonResult;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 *  前端控制器
 * </p>
 *收藏表
 * @author yj
 * @since 2020-08-24
 */
@RestController
@RequestMapping("/users/collection")
public class CollectionController {

	@Autowired
	ICollectionssService collectionssService;
	
	//根据uid查询用户收藏的房源
	@PostMapping("/getcoll")
	public JsonResult getAllColl(int uid) {
		return collectionssService.showCollection(uid);
	}
	
	//根据id删除收藏的房源
	@PostMapping("/delcoll")
	public JsonResult deleteColl(int cid) {
		return collectionssService.deleteCollection(cid);
	}
	
	//添加收藏
	@PostMapping("/addcoll")
	public JsonResult addColl(Collectionss collectionss) {
		return collectionssService.addCollection(collectionss);
	}
	
}
